fix(RAN-68): land RAN-15 capture-target exclusion + cut v0.1.1#9
Merged
fix(RAN-68): land RAN-15 capture-target exclusion + cut v0.1.1#9
Conversation
- Add Test-IsSelfWindowHandle / Resolve-WindowCaptureTarget pure helpers in the Core region (cross-platform unit-tested) so the capture path has a single, testable place to ask "is this hwnd one of ours?". - Maintain a $script:SelfWindowHandles registry; register the console, hotkey form, floating widget, and preview window when they are created, and unregister widget/preview on close. - Add IsWindowVisible / ShowWindow PInvoke and Hide-/Show-OwnSnipITWindowsForCapture helpers that hide every visible SnipIT-owned hwnd before CopyFromScreen and restore them via SW_SHOWNA after the snapshot. Wraps the snapshot in try/finally so a thrown exception still restores chrome. - Wire the helpers into Show-SmartOverlay, Invoke-FullScreenCapture, and Invoke-WindowCapture. Window capture now consults Resolve-WindowCaptureTarget and falls back to a full virtual-desktop capture (with chrome hidden) when the foreground window is SnipIT. Adds 15 new pure-logic regression tests (Test-IsSelfWindowHandle and Resolve-WindowCaptureTarget). Full suite: 105/105 pass. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Invoke-FullScreenCapture and Invoke-WindowCapture grabbed one System.Drawing.Bitmap outside the do/while loop, then handed that same reference to Show-PreviewWindow on every iteration. After the first iteration the preview disposes the bitmap (per the RAN-14 capture-loop contract), so iteration 2+ used a disposed object and crashed / showed a blank frame. - Wrap each grab in a per-iteration factory closure that re-runs Hide-OwnSnipITWindowsForCapture / New-ScreenBitmap / Show-... (so the chrome-hide from RAN-15 still applies to every snapshot). - Route both functions through Invoke-CaptureLoop so the preview owns the bitmap and a fresh one is created each loop. - Add structural regression guards in Test-SnipIT.ps1 (Describe block 'Full-screen and window capture New-snip paths (RAN-14 regression)') that inspect SnipIT.ps1 source to ensure neither function can regress to the pre-loop pattern (no New-ScreenBitmap outside a scriptblock; no `} while ($again)` reuse). Co-Authored-By: Paperclip <noreply@paperclip.ing>
…ection
CHANGELOG.md
- Open new [v0.1.1] - 2026-04-26 section above [v0.1.0]:
- RAN-15 capture flow — exclude SnipIT widget/preview/tray windows
from the capture target (the line incorrectly published under v0.1.0
Fixed; the underlying commit was never on origin/main at v0.1.0
cut time).
- RAN-14 full-screen / window capture refactor — route both functions
through Invoke-CaptureLoop with a per-iteration capture factory.
- Remove the RAN-15 capture-flow line from [v0.1.0] Fixed.
- Append a "Correction (2026-04-26)" callout under [v0.1.0] Fixed
pointing readers at the v0.1.1 entry. The v0.1.0 git tag annotation
and GitHub Release body remain immutable per OSPS evidence policy;
this CHANGELOG entry is the authoritative record.
- Add v0.1.1 link reference; retarget [Unreleased] compare to v0.1.1.
CLAUDE.md
- Drop the literal `bc216cc` SHA from the RAN-15 capture-target
exclusion gotcha (the cherry-pick lands on a new SHA on main).
Replace with "shipped in v0.1.1".
.bestpractices.json
- Unchanged. maintained_justification (line 53) already cites
RAN-15 capture-target exclusion as recent activity, which stays
true once v0.1.1 lands.
Tests: Test-SnipIT.ps1 — 111/111 pass (15 RAN-15 + 7 RAN-14 +
6 structural call-site guards).
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
exclude SnipIT windows from capture targets) onorigin/mainfor the first time. The fix existed locally on the maintainer'smain(commitbc216cc) at the time of the v0.1.0 cut but was never pushed, so the v0.1.0 release notes'Fixedentry attributing this fix to v0.1.0 was inaccurate.Invoke-FullScreenCaptureandInvoke-WindowCaptureroute throughInvoke-CaptureLoopwith a per-iteration factory — fixes the use-after-dispose blank/crash on iteration 2+ (RAN-14 follow-up).CHANGELOG.md: moves the capture-flowFixedline out of[v0.1.0]and into a new[v0.1.1] - 2026-04-26section, and adds aCorrection (2026-04-26)callout under[v0.1.0]pointing readers at v0.1.1. The v0.1.0 git tag annotation and GitHub Release body remain immutable per OSPS evidence policy; this CHANGELOG entry is the authoritative record.bc216ccSHA from the RAN-15 gotcha inCLAUDE.md(the cherry-pick lands on a new SHA).Commits
fix(RAN-15): exclude SnipIT windows from capture targets— cherry-picked from localbc216cc. AddsTest-IsSelfWindowHandle/Resolve-WindowCaptureTargetpure helpers, the$script:SelfWindowHandlesregistry,IsWindowVisible/ShowWindowPInvoke +Hide-/Show-OwnSnipITWindowsForCapturehelpers, and wires them intoShow-SmartOverlay,Invoke-FullScreenCapture, andInvoke-WindowCapture. Adds 15 pure-logic regression tests.fix(RAN-14): route full-screen/window capture through Invoke-CaptureLoop—Invoke-FullScreenCapture/Invoke-WindowCapturepreviously grabbed one bitmap outside the do/while and reused it across iterations; the preview disposes the bitmap on close, so iteration 2+ crashed. Now they go throughInvoke-CaptureLoopwith a per-iteration capture factory that re-runs the chrome-hide each grab. Adds 6 structural source-inspection guards inTest-SnipIT.ps1.docs(RAN-68): correct v0.1.0 release-notes inaccuracy + open v0.1.1 section— CHANGELOG + CLAUDE.md edits described above.Test plan
pwsh ./Test-SnipIT.ps1— 111/111 pass (15 RAN-15 + 7 RAN-14 + 6 new RAN-14 structural call-site guards + the rest of the suite).v0.1.1annotated tag onmainHEAD, pushed to origin.v0.1.1published with body sourced from the v0.1.1 CHANGELOG section.Out of scope